<div class="layui-container fly-marginTop fly-user-main">
    <ul class="layui-nav layui-nav-tree layui-inline" lay-filter="user">
        <li class="layui-nav-item">
            <a href={:url("index/user/index",['uid'=>session('uid')])}>
                <i class="layui-icon">&#xe609;</i>我的主页</a></li>
        <li class="layui-nav-item ">
            <a href="{:url('index/user/myart',['uid'=>session('uid')])}">
                <i class="layui-icon">&#xe612;</i>用户中心</a></li>
        <li class="layui-nav-item ">
            <a href="{:url('index/user/set')}">
                <i class="layui-icon">&#xe620;</i>基本设置</a></li>
        <li class="layui-nav-item layui-this">
            <a href="{:url('index/user/msg')}">
                <i class="layui-icon">&#xe611;</i>我的消息</a></li>
        <li class="layui-nav-item ">
            <a href="/auth/get/">
                <i class="layui-icon">&#xe61e;</i>产品授权</a></li>
    </ul>
    <div class="site-tree-mobile layui-hide">
        <i class="layui-icon">&#xe602;</i></div>
    <div class="site-mobile-shade"></div>
    <div class="fly-panel fly-panel-user" pad20>
        <div class="layui-tab layui-tab-brief" lay-filter="user" id="LAY_msg" style="margin-top: 15px;">
            <button class="layui-btn layui-btn-danger " id="LAY_delallmsg">清空全部消息</button>
            <div id="LAY_minemsg" style="margin-top: 10px;">
                <ul class="mine-msg">

                    {foreach $msg as $v}

                    <li data-id="85636">
                        {if condition="$v.status > 1"}
                        <blockquote class="layui-elem-quote">您在{$v.name}
                            <a target="_blank" href="{:url('index/question/index',['qid'=>$v['qid']])}">
                                <cite>{$v.title}</cite>
                            </a>

                            中的回答，被
                        {/if}
                        {if condition="$v.status <= 1"}
                            <blockquote class="layui-elem-quote">您的提问
                                <a target="_blank" href="{:url('index/question/index',['qid'=>$v['qid']])}">
                                    <cite>{$v.title}</cite>
                                </a>
                                被
                        {/if}

                            {if condition="$v.status == 2" /}
                            <a href="{:url('index/user/index',['uid'=>$v['uid']])}">{$v.nickname}</a>点赞
                            {elseif condition="$v.status == 3" /}
                            <a href="{:url('index/user/index',['uid'=>$v['uid']])}">{$v.nickname}</a>@你
                            {elseif condition="$v.status == 4" /}
                            <a href="{:url('index/user/index',['uid'=>$v['uid']])}">{$v.nickname}</a>采纳为最佳答案喔！

                            {elseif condition="$v.status == 0" /}
                            <a href="{:url('index/user/index',['uid'=>$v['uid']])}">{$v.nickname}</a>回复

                            {elseif condition="$v.status == 1" /}
                            <a href="{:url('index/user/index',['uid'=>$v['uid']])}">{$v.nickname}</a>收藏
                            {/if}
                        </blockquote>

                        <p>
                            <span>{:Ftime($v.ctime)}</span>

                            <a  mid = '{$v.mid}'  href="javascript:;" class="layui-btn layui-btn-sm layui-btn-danger fly-delete clearOne">

                                删除

                            </a>

                        </p>
                    </li>

                    {/foreach}
                </ul>
            </div>
        </div>
    </div>
</div>

<script>
    layui.use(['jquery','layer'], function() {
        var $ = layui.jquery;
        var layer = layui.layer;
        $('.clearOne').click(function () {
            mid = $(this).attr('mid');
            that = $(this);
            $.ajax({
                url:"{:url('Index/Msg/clearMsg')}",
                type: 'post',
                data:{'mid':mid},
                dataType: 'json',
                success: function (data) {
                    if(data.error ==1){
                        layer.msg(data.info, function(){
                        });
                    }else if(data.error ==0){
                        that.parent().parent().remove()
                    }
                },
                fail: function (err) {
                    console.log(err)
                }
            })

        })
        $('#LAY_delallmsg').click(function () {
            that = $(this);
            $.ajax({
                url:"{:url('Index/Msg/clearAll')}",
                type: 'post',
                dataType: 'json',
                success: function (data) {
                    if(data.error ==1){
                        layer.msg(data.info, function(){
                        });
                    }else if(data.error ==0){
                        $('#LAY_minemsg').remove()
                    }
                },
                fail: function (err) {
                    console.log(err)
                }
            })

        })


    });
</script>